<template>
	<view class="fui-wrap">
		<fui-list>
			<fui-list-cell v-for="(item,index) in list" :key="index" :highlight="false">
				
				<view class="item" v-if="current==1">
					<view>
						<text style="color: #afafaf;font-size: 28rpx;">时间：</text>
						<text style="color: black;font-size: 28rpx;">{{item.createtime}}</text>
						<fui-tag v-if="!item.remark" text="申请中" type="danger"></fui-tag>
					</view>
					<view class="line-column">
						<view class="two">
							<fui-text text="提现前：" color="#afafaf" :size="28"></fui-text>
							<fui-text :text="item.before" :size="28"></fui-text>
						</view>
						<view class="two">
							<fui-text text="提现金额：" color="#afafaf" :size="28"></fui-text>
							<fui-text :text="item.change" :size="28"></fui-text>
						</view>
						<view class="two">
							<fui-text text="提现后：" color="#afafaf" :size="28"></fui-text>
							<fui-text :text="item.after" :size="28"></fui-text>
						</view>
					</view>
				</view>
				<view class="item" v-else>
					<view>
						<text style="color: #afafaf;font-size: 28rpx;">日期：</text>
						<text style="color: black;font-size: 28rpx;">{{item.date}}</text>
					</view>
					<view class="line-column">
						<view class="two">
							<fui-text text="结算前：" color="#afafaf" :size="28"></fui-text>
							<fui-text :text="item.before" :size="28"></fui-text>
						</view>
						<view class="two">
							<fui-text text="结算金额：" color="#afafaf" :size="28"></fui-text>
							<fui-text :text="item.change" :size="28"></fui-text>
						</view>
						<view class="two">
							<fui-text text="结算后：" color="#afafaf" :size="28"></fui-text>
							<fui-text :text="item.after" :size="28"></fui-text>
						</view>
					</view>
					<view>
						<text style="color: #afafaf;font-size: 28rpx;">停车场：</text>
						<text style="color: black;font-size: 28rpx;">{{item.parking.title}}</text>
					</view>
				</view>
			</fui-list-cell>
		</fui-list>
		<fui-empty v-if="list.length===0" :src="`${baseUrl}assets/img/miniapp/empty.png`" title="暂无数据!" :marginTop="200"></fui-empty>
	</view>
</template>

<script>
	import {methods,baseUrl} from '@/utils/core.js';
	export default {
		data() {
			return {
				baseUrl:baseUrl,
				parking_id:'',
				current:0,
				list:[],
				page:1,
				endData:false
			}
		},
		onLoad(e) {
			this.parking_id=e.parking_id || '';
			this.current=e.type;
			this.getList();
		},
		onReachBottom() {
			this.getList();
		},
		onPullDownRefresh() {
			this.list=[];
			this.page=1;
			this.endData=false;
			this.getList(function(){
				uni.stopPullDownRefresh();
			});
		},
		methods: {
			...methods,
			getList:function(callback=false){
				this.showPopup=false;
				if(this.endData){
					this.$msg('已经到底了');
					return;
				}
				this.$get('daili/log',{
					parking_id:this.parking_id,
					type:this.current,
					page:this.page
				},true).then(res=>{
					this.list=this.list.concat(res);
					this.page++;
					if(res.length<10){
						this.endData=true;
					}	
					if(callback){
						callback();
					}
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
.item{
	display: flex;
	flex-wrap: wrap;
	.line{
		display: flex;
		align-items: center;
		width:100%;
		height: 60rpx;	
	}
	.line-column{
		display: flex;
		align-items: center;
		justify-content: space-between;
		width:100%;
		margin-top: 14rpx;
		.two{
			padding-bottom: 20rpx;
			justify-content: space-between;
			display: flex;
			flex-direction: column;
			height: 90rpx;
		}
	}
}
</style>